﻿<phone:PhoneApplicationPage 
    x:Class="DailyBread.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:localControls="clr-namespace:Microsoft.Phone.Controls" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True"
    ApplicationBar="{StaticResource MainAppBar}" 
    xmlns:my="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="80"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <my:AdControl Height="80" HorizontalAlignment="Center" Name="adControl1" IsAutoRefreshEnabled="True"
                      VerticalAlignment="Center" Width="480" 
                      ApplicationId="ae73d70b-324b-4a2c-a79e-41cf96f77eaf" 
                      AdUnitId="31855"
                      />
        <controls:Panorama Grid.Row="1" x:Name="PanoramaControl">
            <controls:PanoramaItem>
                <controls:PanoramaItem.Header>
                    <ContentControl>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Daily Bread" Style="{StaticResource PhoneTextTitle2Style}" HorizontalAlignment="Left" Margin="0,0,10,0"/>
                            <Image x:Name="FavImg" Source="images/fav.png" Visibility="Collapsed"/>
                        </StackPanel>
                    </ContentControl>
                </controls:PanoramaItem.Header>
                <Grid Background="{StaticResource TransparentBackground}">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <toolkit:PerformanceProgressBar x:Name="BreadProgressBar" Foreground="White"/>
                    <ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Visible" >
                        <TextBlock x:Name="Article" Style="{StaticResource PhoneTextNormalStyle}"  TextWrapping="Wrap" />
                    </ScrollViewer>
                </Grid>
            </controls:PanoramaItem>
            <controls:PanoramaItem>
                <controls:PanoramaItem.Header>
                    <ContentControl>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Bible Verse" Style="{StaticResource PhoneTextTitle2Style}" HorizontalAlignment="Left" Margin="0,0,10,0"/>
                            <Image x:Name="FavImg2" Source="images/fav.png" Visibility="Collapsed"/>
                        </StackPanel>
                    </ContentControl>
                </controls:PanoramaItem.Header>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <TextBlock x:Name="RefBible" Style="{StaticResource PhoneTextTitle3Style}"/>
                    <Grid Grid.Row="1" Background="{StaticResource TransparentBackground}">
                        <toolkit:PerformanceProgressBar x:Name="VerseProgressBar" Foreground="White"/>
                        <ScrollViewer VerticalScrollBarVisibility="Visible" >
                            <TextBlock Style="{StaticResource PhoneTextNormalStyle}"  TextWrapping="Wrap"   x:Name="Verse" />
                        </ScrollViewer>
                    </Grid>
                </Grid>
            </controls:PanoramaItem>
            <controls:PanoramaItem>
                <controls:PanoramaItem.Header>
                    <ContentControl>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Comments" Style="{StaticResource PhoneTextTitle2Style}" HorizontalAlignment="Left" Margin="0,0,10,0"/>
                            <Image x:Name="FavImg3" Source="images/fav.png"  Visibility="Collapsed"/>

                        </StackPanel>
                    </ContentControl>
                </controls:PanoramaItem.Header>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock x:Name="RefBibleOnCommentsPage" Margin="0,0,20,0" Style="{StaticResource PhoneTextTitle3Style}"/>
                        <TextBlock x:Name="FavCount" Margin="0,0,0,0" Style="{StaticResource PhoneTextTitle3Style}" Text="{Binding ServerFavCount}" Visibility="Collapsed"/>
                        <Image x:Name="Thumbup" Source="images/thumb-up-icon.png" Visibility="Collapsed"/>
                    </StackPanel>
                    <StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0,0,0,10">
                        <TextBox x:Name="CommentBox"
                                 Text="Share your thoughts..."
                                 Foreground="Gray"
                                 GotFocus="CommentBox_GotFocus" 
                                 LostFocus="CommentBox_LostFocus"
                                 InputScope="Text"
                                 Margin="0,0,10,0" Width="363" 
                                 TextWrapping="Wrap" >
                        </TextBox>
                        <Image x:Name="PostButton" Source="images/comments-add-icon.png" MouseLeftButtonUp="PostButton_Click" Width="48" VerticalAlignment="Center" />
                    </StackPanel>
                    <Grid Grid.Row="2" Background="{StaticResource TransparentBackground}">
                        <TextBlock x:Name="MessageBlock" TextWrapping="Wrap"  Visibility="Collapsed" />
                    </Grid>
                    <Grid Grid.Row="3" >
                        <toolkit:PerformanceProgressBar x:Name="CommentProgressBar" Foreground="White"/>
                        <ListBox x:Name="CommentList" Background="{StaticResource TransparentBackground}" 
                            Height="500"     ScrollViewer.VerticalScrollBarVisibility="Auto" >
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Grid x:Name="Comment" MouseLeftButtonDown="Comment_MouseLeftButtonDown" MouseLeftButtonUp="Comment_MouseLeftButtonUp_1">
                                        <toolkit:ContextMenuService.ContextMenu>
                                            <toolkit:ContextMenu>
                                                <toolkit:MenuItem Header="delete" Click="CommentContextMenuDelete_Click"/>
                                            </toolkit:ContextMenu>
                                        </toolkit:ContextMenuService.ContextMenu>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="*"/>
                                        </Grid.RowDefinitions>
                                        <TextBlock x:Name="TextBlockComment"  TextWrapping="Wrap" Text="{Binding Comment}" />
                                        <StackPanel Grid.Row="1" Orientation="Horizontal">
                                            <TextBlock Text="posted on " FontSize="13" FontStyle="Italic"/>
                                            <TextBlock x:Name="TexBlockCommentPostTime" FontSize="13" Margin="0,0,0,10" Text="{Binding DateForDisplay}" />
                                        </StackPanel>
                                    </Grid>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </Grid>
                </Grid>
            </controls:PanoramaItem>
        </controls:Panorama>
    </Grid>
    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>
</phone:PhoneApplicationPage>